﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using Xyz.DataObjects;
using Xyz.DataObjects.Interfaces;
using Xyz.BusinessObjects;
using Xyz.Service.DataTransferObjects;
using Xyz.Service.ServiceContracts;


namespace Xyz.Service
{
    /// <summary>
    /// This service will handle all methods for Passenger
    /// </summary>
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]
    public class PassengerService : IPassengerService
    {
        public static readonly IPassengerDao PassengerDao = DataAccess.PassengerDao;

        public void InsertPassenger(PassengerDTO passenger)
        {
            var pas = Mapper.FromDto(passenger);

            if (pas.Validate())
            {
                PassengerDao.InsertPassenger(pas);
            }
        }

        public List<TitleDTO> GetTitles()
        {
            return Mapper.ToDto(PassengerDao.GetTitles());
        }
    }
}
